package Management;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class DivisionFrame extends JFrame implements ActionListener{

	JLabel label = new JLabel("Select a Division");
	JPanel panel = new JPanel();
	JButton accept = new JButton("Accept");
	JButton cancel = new JButton("Cancel");
	String [] DivisionStrings = {"8th Ave", "25th Ave"};
	

	DivisionFrame(){
		super("Division Frame");
		setSize(300,200);
		setLocation(500,280);
		panel.setLayout (null); 
		
        JComboBox DivisionList = new JComboBox(DivisionStrings);

        DivisionList.addActionListener(this);
		//DivisionList.setSelectedIndex(2);
        updateLabel(DivisionStrings[DivisionList.getSelectedIndex()]);
		
		label.setBounds(70,10,150,60);
		DivisionList.setBounds(70, 50, 150, 20);
		accept.setBounds(50,100,80,20);
		cancel.setBounds(160,100,80,20);
			
		panel.add(label);
		panel.add(DivisionList);
		panel.add(accept);
		panel.add(cancel);
		
		
		getContentPane().add(panel);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
		actioncompany();

	}
	
	public void actionPerformed(ActionEvent e){
		JComboBox cb = (JComboBox)e.getSource();
		String DivisionName = (String)cb.getSelectedItem();
		updateLabel(DivisionName);
		
	}
	
	 protected void updateLabel(String name) {
	        
	    }
	
	public void actioncompany(){
		accept.addActionListener(new ActionListener() {
	
			public void actionPerformed(ActionEvent ae) {
				MainWindow mainframe = new MainWindow();
				mainframe.main(null);

				dispose();

			}
		});
		
		cancel.addActionListener(new ActionListener() {
			
			public void actionPerformed(ActionEvent ae) {
				
				Login.main(null);
				dispose();

			}
		});
	}
	
	public static void main(String[] args) {

		DivisionFrame divisionFrame = new DivisionFrame();
		divisionFrame.setLocationRelativeTo(null);
		
}
}

